Explore PhenoCam Data

Author

Alison Post

Published

July 24, 2024

Some code adapted from the 2020 NEON Tutorial by Bijan Seyednasrollah

Introduction to PhenoCam

Established in 2008, the PhenoCam Network is a collection of >700 digital cameras that take regular (~ every 30 min) pictures of ecosystem canopies around the world. The name PhenoCam comes from the combination of the words “phenology” and “camera”, because the images are an easy and effective way to study the phenology, or the timing of seasonal changes, of vegetation across diverse ecosystems. The images are available in near-real time to view on the PhenoCam website, and can also be downloaded through the phenocamapi R package, which we’ll cover in this tutorial. There are currently over 60 million images available!

PhenoCam locations across North America (screenshot from phenocam.nau.edu).

Illustration of a PhenoCam (red circle) over a tree canopy collecting phenology data (Image from Richardson 2019, illustrator: Victor Leshyk).

Quantifying Greenness

Beyond being pretty pictures, PhenoCam images also provide a quantitative way to track vegetation phenology by measuring the intensity of canopy greenness. Digital images are stored as three different color channels - red, green, and blue (RGB) - which are the primary colors of light, and combine in different ratios to create all the visible colors in a photograph. Old-style TVs use this same method, as does your smartphone.

The primary colors of light combine to create all visible colors in digital images.

Each digital pixel has a numerical value for each color channel (RGB) that represents its intensity. We can use these values to quantify the relative intensity of green compared to the overall brightness of the image. We call this the Green Chromatic Coordinate (GCC) and calculate it using the equation below.

Equation to calculate the relative greenness (GCC) of a digital image.

However, since PhenoCam images usually capture other things besides just the vegetation canopy (e.g., sky, ground, roads, buildings), each site has established portions of the image, or regions of interest (ROIs), that are analyzed for greenness. For example, at this forested site in Canada (lacclair), only the trees in the foreground are included in the GCC calculation:

Example of an ROI (unshaded portion) for a forest site.

And at this shrub site, only the shrub plants are included in the ROI and bare ground is excluded.

ROI (unshaded portion) for a shrub site- bare ground is excluded.

When GCC is calculated over a long time period at a site, a timeseries of vegetation greenness can be created. Below is the GCC timeseries for the “laccair” forest site shown above over the past 9 years. Notice the clear seasonal cycle of vegetation green-up in the spring followed by leaf color change and senescence (brown-down/death) in autumn.

Timeseries of canopy greeness (GCC) at a forest site in Canada (lacclair).

Seasonal Transition Dates

These GCC timeseries can be used to extract seasonal transition dates across the years. For example, to determine the timing of spring green-up, we can use the amplitude (height) of each annual peak to determine when (what day of the year) vegetation at the site has reached either 10%, 25%, or 50% of its maximum greenness. We consider this to be the start of spring green-up. We use a similar method to extract the start of autumn brown-down.

The dates of spring green-up (green symbols) and autumn brown-down (brown symbols) can be extracted from the GCC timeseries.

Over a long time period, the timing of seasonal transition dates can be used to track shifts in vegetation phenology, such as with climate change. This dataset can also be used to determine which environmental and biologic factors (e.g., temperature, rainfall, sunlight) influence the timing of spring leaf-out and autumn color changes.

Seasonal transition dates at a deciduous forest site in Canada (lacclair) over the past 9 years.

Your turn!

Thanks for learning about PhenoCam. Now you’ll have the chance to access images and data from a PhenoCam site of your choosing following the tutorial below!

Accessing PhenoCam Data

We’ll be using the phenocamapi R package to directly download PhenoCam data. An API is an application programming interface (API), which is a way for two or more applications/computers to talk with one another. In this case, it allows us to directly access data from the PhenoCam database.

Then, you’ll choose a site to view some images and download greenness data. Finally, you’ll create a gif (short movie) of your site through time.

First, we need to open the required packages. A package is a collection of functions/tools to complete a desired task. For example, you need a certain set of tools to build a birdhouse, but a different set of tools to bake a cake. In this case, the phenocamapi and phenocamr packages have the tools to interact with and download phenocam data. The other packages listed below assist with visualization and formatting.

library(phenocamapi)
library(phenocamr)
library(jpeg)
library(purrr) 
library(magick)
library(lubridate)
library(ggplot2)
library(pals)
library(maps)
library(plotly)

Next, indicate a location (file path) where you want the PhenoCam images to save. For this workshop, we’ll create a new file within GitHub Codespaces called pheno_images.

Tip

In the future, if you’re using R Studio locally on your computer, you can enter the path to a local directory, or folder, on your computer instead (e.g., “/Users/username/Desktop/pheno_images”). Make sure to use the right character to separate folder names – forward slash (/) on Unix/Mac systems and backslash (\) on Windows. Notice that we use the file.path() function, which uses the correct file separator on all systems.

# Designate directory (file path)
dir = file.path('.', 'pheno_images')

# Create test_images folder
dir.create(dir)

# View directory
dir
[1] "./pheno_images"

First, we’ll download a table to see all the available PhenoCam sites and associated metadata. For example, each entry lists a site’s geographic coordinates, date of first and last image, primary vegetation type (see table below for abbreviations), and mean annual temperature and precipitation, among other things.

Vegetation types:

Abbreviation Vegetation Type
AG Agriculture
DB Deciduous Broadleaf
EB Evergreen Broadleaf
EN Evergreen Needleleaf
DN Deciduous Needleleaf
GR Grassland
MX Mixed Forest
NV Non-vegetated
SH Shrub
TN Tundra
UN Understory
WL Wetland
# List metadata of all sites
sitelist_table <- get_phenos() 

sitelist_table

You can filter the table by any of the available attributes (column names). For example, I created a subset of only grasslands (GR) sites below.

# Create a subset of only grassland sites 
GR_sites <- subset(sitelist_table, primary_veg_type == "GR")  
GR_sites
                    site      lat        lon  elev active utc_offset date_first
                  <char>    <num>      <num> <num> <lgcl>      <num>     <char>
  1:       archboldbahia 27.16560  -81.21611     8   TRUE         -5 2017-03-21
  2:            arsgacp2 31.43950  -83.59146   101  FALSE          2 2016-04-27
  3:      bitterbrush001 48.15400 -119.94560   667   TRUE         -8 2020-09-20
  4: blueoakheadquarters 37.38270 -121.73930   572   TRUE         -8 2022-01-24
  5:             bozeman 45.78306 -110.77778  2332  FALSE         -7 2015-08-16
 ---                                                                           
145:         uiefprairie 40.06462  -88.19847   224   TRUE         -6 2008-10-22
146:            usgseros 43.73430  -96.62340   448   TRUE         -6 2014-09-04
147:       utepgreenroof 31.76860 -106.50390  1190   TRUE         -7 2022-01-13
148:               vaira 38.41328 -120.95064   129   TRUE         -8 2009-01-01
149:             waahila 21.30170 -157.81520    55   TRUE        -10 2015-12-11
      date_last infrared                                  contact1
         <char>   <char>                                    <char>
  1: 2024-07-22        Y Amartya Saha <asaha@archbold-station.org>
  2: 2018-01-23        Y    David Bosch <David.Bosch@ars.usda.gov>
  3: 2024-05-25        Y Brandon Sackmann <bssackmann@gsi-net.com>
  4: 2024-07-22        Y Zachariah Tuhtill <ztuthill@berkeley.edu>
  5: 2019-12-18        Y           Paul Stoy <paul.stoy@gmail.com>
 ---                                                              
145: 2024-01-26        N    Carl Bernacchi <bernacch@illinois.edu>
146: 2024-07-22        Y                Jesslyn <jfbrown@usgs.gov>
147: 2024-07-22        Y      Gesuri Ramirez <gramirez12@utep.edu>
148: 2024-07-09        Y Dennis Baldocchi <Baldocchi@berkeley.edu>
149: 2024-07-22        Y    Clay Trauernicht <trauerni@hawaii.edu>
                                                contact2
                                                  <char>
  1: Elizabeth Boughton <eboughton@archbold-station.org>
  2:                                                    
  3:            Brandon Sackmann <bssackmann@gsienv.com>
  4:                Zachary Harlow <harlow@berkeley.edu>
  5:                                                    
 ---                                                    
145:                 Timothy A Mies <tmies@illinois.edu>
146:              Ken Mayer <kenneth.mayer.ctr@usgs.gov>
147:               Vanessa Lougheed <vlougheed@utep.edu>
148:           Joseph Verfaillie <jverfail@berkeley.edu>
149:                        Ryan Mudd <rmudd@hawaii.edu>
                                                                          site_description
                                                                                    <char>
  1:                                             Archbold Biological Station, Florida, USA
  2:                           Southeast Watershed Research Laboratory EC2 Tifton, Georgia
  3: Parcel 1 East at Midpoint (Shrub-Steppe - Post Wildfire ca. 2014), Methow, Washington
  4:                      Residence Meadow, Blue Oak Ranch Reserve, Santa Clara County, CA
  5:                                Bangtail Study Area, Montana State University, Montana
 ---                                                                                      
145:            Restored prairie at the University of Illinois Energy Farm, Urbana, IL USA
146:                          Earth Resources Observation and Science Center, South Dakota
147:             Green Roof, University of Texas at El Paso, Biology Building, El Paso, TX
148:                                                Vaira Ranch, Amador County, California
149:                        Waahila Ridge, University of Hawaii at Manoa, Honolulu, Hawaii
     site_type                 group camera_description camera_orientation
        <char>                <char>             <char>             <char>
  1:         I                  LTAR  StarDot NetCam SC                  N
  2:         I                  LTAR               <NA>               <NA>
  3:         I                  <NA>  StarDot NetCam SC                  W
  4:         I                  <NA>  StarDot NetCam SC                  N
  5:         I AmericaView AMERIFLUX  StarDot NetCam SC                  N
 ---                                                                      
145:        II              PhenoCam          AXIS 211M                  N
146:         I           AmericaView  StarDot NetCam SC                  N
147:         I                  <NA> StarDot NetCam SC.                  E
148:         I    PhenoCam AMERIFLUX  StarDot NetCam SC                 NW
149:         I                        StarDot NetCam SC                ENE
     flux_data flux_networks       flux_sitenames
        <lgcl>        <list>               <char>
  1:     FALSE     <list[0]>                 <NA>
  2:     FALSE     <list[0]>                 <NA>
  3:     FALSE     <list[0]>                     
  4:     FALSE     <list[0]>                     
  5:      TRUE     <list[1]> US-MTB (forthcoming)
 ---                                             
145:      TRUE     <list[1]>                     
146:     FALSE     <list[0]>                     
147:     FALSE     <list[0]>                 <NA>
148:      TRUE     <list[1]>               US-Var
149:     FALSE     <list[0]>                     
                                                                                                                                                                                                                                                                                                                                                                dominant_species
                                                                                                                                                                                                                                                                                                                                                                          <char>
  1:                                                                                                                                                                                                                                                                                                                                                                            
  2:                                                                                                                                                                                                                                                                                                                                                                            
  3:                                                                                                                                                                                                                                                                                                                                                                            
  4:                                                                                                                                                                                                                                                                                                                             Avena spp., Quercus lobata, Elymus trachycaulus
  5:                                                                                                                                                                                                                                                                                                                                                          Festuca idahoensis
 ---                                                                                                                                                                                                                                                                                                                                                                            
145: Andropogon gerardii (Big bluestem), Coreopsis tripteris (Tall tickseed), Elymus canadensis (Canada wild rye), Helianthus grosseserratus (Sawtooth sunflower), Heliopsis helianthoides (Early sunflower), Ratibida pinnata (Yellow coneflower), Rudbeckia subtomentosa (Sweet blackeyed Susan), Schizachyrium scoparium (Little bluestem), Solidago rigida (Stiff goldenrod)
146:                                                                                                                                                                                                                                                                                           Andropogon gerardii, Poa pratensis, Bouteloua curtipendula, Melilotus officinalis
147:                                                                                                                                                                                                                                                                                                           Thymophylla pentachaeta, Gaillardia pulchella, Berlandiera lyrata
148:                                                                                                                                                                                                                                                     Brachypodium distachyon, Hypochaeris glabra, Trifolium dubium, Trifolium hirtum, Dichelostemma volubile, Erodium botrys
149:                                                                                                                                                                                                                                                                                                                                                         Megathyrsus maximus
     primary_veg_type secondary_veg_type site_meteorology MAT_site MAP_site
               <char>             <char>           <lgcl>    <num>    <num>
  1:               GR               <NA>            FALSE       NA       NA
  2:               GR               <NA>            FALSE       NA       NA
  3:               GR                 SH            FALSE      8.7      323
  4:               GR                 DB            FALSE     13.4      600
  5:               GR                 EN            FALSE      5.0      850
 ---                                                                       
145:               GR               <NA>             TRUE     11.1     1042
146:               GR                 SH             TRUE      7.6      670
147:               GR               <NA>            FALSE     18.0      247
148:               GR               <NA>             TRUE     15.8      559
149:               GR                 SH             TRUE     22.5     1150
     MAT_daymet MAP_daymet MAT_worldclim MAP_worldclim koeppen_geiger ecoregion
          <num>      <num>         <num>         <num>         <char>     <num>
  1:      22.85       1302          22.5          1208            Cfa         8
  2:      19.00       1251          18.7          1213            Cfa         8
  3:       8.35        420           7.3           340            Dsb        10
  4:      14.35        501          14.3           646            Csb        11
  5:       2.30        981           0.9           728            Dfb         6
 ---                                                                           
145:      11.10       1063          10.9           971            Dfa         8
146:       7.50        699           7.0           626            Dfa         9
147:      17.75        234          17.3           219            BWk        10
148:      16.65        659          15.9           583            Csa        11
149:      24.20       1639          24.0          1152             As        NA
     landcover_igbp dataset_version1
              <num>           <lgcl>
  1:             14               NA
  2:             14               NA
  3:              1               NA
  4:              8               NA
  5:             10               NA
 ---                                
145:             12               NA
146:             12               NA
147:             13               NA
148:              8               NA
149:             13               NA
                                                                                                                                                                                                                                                   site_acknowledgements
                                                                                                                                                                                                                                                                  <char>
  1:                                                                                                        This research was a contribution from the Long-Term Agroecosystem Research (LTAR) network. LTAR is supported by the United States Department of Agriculture.
  2:                                                                                                        This research was a contribution from the Long-Term Agroecosystem Research (LTAR) network. LTAR is supported by the United States Department of Agriculture.
  3:                                                                                                                                                                 Research at this site is supported by GSI Environmental Inc. (http://www.gsi-net.com), Olympia, WA.
  4:                                                                                                     Blue Oak Ranch Reserve is part of the University of California Natural Reserve System. Blue Oak Ranch is administered bu the University of California, Berkeley
  5: Research at the Bozeman site is supported by Colorado State University and the AmericaView program (grants G13AC00393, G11AC20461, G15AC00056) with phenocam equipment and deployment sponsored by the Department of Interior North Central Climate Science Center.
 ---                                                                                                                                                                                                                                                                    
145:                                                                                                                     The UIUC Energy Farm flux towers are supported by the Global Change and Photosynthesis Research Unit of the USDA Agricultural Research Service.
146:                                                                                                                                      This site is supported by AmericaView, the USGS Land Remote Sensing program, and the DOI North Central Climate Science Center.
147:                                                                                                                                                                                                                                                                    
148:                                                                                                                                                                                                                                                                    
149:                                                                                                                              Hawaii RREA Program (USDA-NIFA), HAWN-01-025, College of Tropical Agriculture and Human Resources at the University of Hawaii at Manoa
                             modified flux_networks_name
                               <char>             <char>
  1: 2022-10-19T13:24:12.256706-04:00               <NA>
  2: 2022-10-19T13:26:15.042047-04:00               <NA>
  3: 2020-10-30T10:48:53.990761-04:00               <NA>
  4: 2021-04-12T09:54:24.431967-04:00               <NA>
  5: 2016-11-01T15:42:19.771057-04:00          AMERIFLUX
 ---                                                    
145: 2017-05-16T14:04:31.190825-04:00              OTHER
146: 2017-05-24T16:16:07.599517-04:00               <NA>
147: 2023-11-18T13:35:23.500156-05:00               <NA>
148: 2019-05-23T15:54:21.000061-04:00          AMERIFLUX
149: 2017-09-20T13:34:52.922933-04:00               <NA>
            flux_networks_url flux_networks_description
                       <char>                    <char>
  1:                     <NA>                      <NA>
  2:                     <NA>                      <NA>
  3:                     <NA>                      <NA>
  4:                     <NA>                      <NA>
  5: http://ameriflux.lbl.gov         AmeriFlux Network
 ---                                                   
145:                                 Other/Unaffiliated
146:                     <NA>                      <NA>
147:                     <NA>                      <NA>
148: http://ameriflux.lbl.gov         AmeriFlux Network
149:                     <NA>                      <NA>
Challenge

Can you subset the sitelist_table by a different primary vegetation type? How about by a different variable (table column)? Use the code cell below.

Create a Map of the PhenoCam Sites

Now, we’ll create an interactive map to view all the PhenoCam sites colored by their primary vegetation type. First, using our sitelist_table that we downloaded above, we filter out any sites for which a primary vegetation type isn’t listed or an “NA” is entered. We’ll call this new data table “sitelist_table2”.

# Remove sites with NA and empty cells for primary_veg_type
sitelist_table2 <- sitelist_table[!(is.na(sitelist_table$primary_veg_typ) | sitelist_table$primary_veg_typ==""), ]

Then, we’ll create a static map of the PhenoCam sites using their latitude and longitude (included in “sitelist_table2”). We’ll overlay this onto a basemap of the world and US states.

# Download basemaps of the world and US states
world_map <- map_data("world")
state_map <- map_data("state")

## Create map of sites
Site_map <- ggplot() +
    # Add world map  
    geom_polygon(data = world_map, aes(x = long, y = lat, group = group), 
                fill = "white", color = "black") +
    # Add state map
    geom_polygon(data = state_map, aes(x = long, y = lat, group = group), 
                fill = NA, color = "black") +  
    # Add PhenoCam sites as points
    geom_point(data = sitelist_table2, aes(x = lon, y = lat,
                color = primary_veg_type,
                text = paste("Site:", site)), size = 3) +
    # Choose legend colors  
    scale_color_manual(values=as.vector(trubetskoy(11))) + 
    # Add title and labels  
    labs(title = "PhenoCam Sites by Vegetation Type", x = "Longitude", 
        y = "Latitude", color = "Primary Veg Type") +
    # Indicate map theme (general appearance)
    theme_minimal() +
    # Center title and increase font size
    theme(plot.title = element_text(hjust = 0.5, size = 20))
  
# View map
Site_map

Challenge

Can you change the title of the map? Make the change and re-run the code cell above.

Let’s make the map interactive! You can hover over sites to see their details, draw a box around a specific area to zoom into the region, and click on various legend entries to toggle them on or off. Double click on the map to zoom back out.

# Make map interactive
ggplotly(Site_map)

Download & Plot Canopy Greenness

Now, let’s view some PhenoCam images and greenness data. Choose a site to explore, and enter the site name and relevant information in the cell below. For example, I chose the site “lacclair”, which represents a deciduous broadleaf (“DB”) vegetation type, and I chose to look at images from the year 2022. You’ll also need to specify which region of interest (ROI) to use for your site. Recall that some sites have multiple ROIs, each with a unique ID number. You can view the possible ROIs for your site on the PhenoCam website.

# Choose site to explore 
# Enter name exactly as it appears in the table/on the website
site_name = "lacclair"

# Indicate vegetation type (listed on site page)
veg = "DB"

# Choose data year (for downloading images later)
year = 2022

# Indicate ROI ID
ROI = 1000

# View the objects to make sure correct
site_name
[1] "lacclair"
veg
[1] "DB"
year
[1] 2022
ROI
[1] 1000

First, we’ll download canopy greenness (GCC = green chromatic coordinate) timeseries data for your chosen site. The GCC data are already condensed down to 1-day and 3-day data products (type = ‘3day’ or ‘1day’). See Richardson et al. (2018) for more information about PhenoCam data processing.

# Download GCC timeseries
GCC_timeseries <- get_pheno_ts(site = site_name, 
                               vegType = veg, 
                               roiID = ROI, 
                               type = '3day')
GCC_timeseries
            date  year   doy image_count                midday_filename
          <char> <int> <int>       <int>                         <char>
   1: 2014-08-24  2014   236          48 lacclair_2014_08_24_120005.jpg
   2: 2014-08-27  2014   239          11 lacclair_2014_08_27_100006.jpg
   3: 2014-08-30  2014   242          12 lacclair_2014_08_29_140006.jpg
   4: 2014-09-02  2014   245           0                           None
   5: 2014-09-05  2014   248           0                           None
  ---                                                                  
1206: 2024-07-09  2024   191          79 lacclair_2024_07_09_120005.jpg
1207: 2024-07-12  2024   194          78 lacclair_2024_07_12_120007.jpg
1208: 2024-07-15  2024   197          77 lacclair_2024_07_15_120005.jpg
1209: 2024-07-18  2024   200          77 lacclair_2024_07_18_120005.jpg
1210: 2024-07-21  2024   203          52 lacclair_2024_07_21_120005.jpg
       midday_r  midday_g midday_b midday_gcc midday_rcc    r_mean    r_std
          <num>     <num>    <num>      <num>      <num>     <num>    <num>
   1: 112.49521 107.31002 64.79199    0.37706    0.39528 101.21337 10.45700
   2: 102.96825  99.27311 58.65611    0.38051    0.39467  99.80690  7.75972
   3: 101.57938  96.23061 61.00618    0.37181    0.39248 105.63914  3.39082
   4:        NA        NA       NA         NA         NA        NA       NA
   5:        NA        NA       NA         NA         NA        NA       NA
  ---                                                                      
1206:  66.14564  78.34146 44.05530    0.41551    0.35083  82.81701  7.76660
1207:  87.48138  94.75240 53.68124    0.40164    0.37082  80.05064 11.47252
1208:  97.34581 100.29843 56.42505    0.39477    0.38315  83.92396 10.45357
1209:  87.71406  95.76012 53.93593    0.40335    0.36946  87.25429 12.35282
1210:  69.31691  79.30429 53.96135    0.39147    0.34217  91.37739 11.80802
        g_mean    g_std   b_mean   b_std gcc_mean gcc_std  gcc_50  gcc_75
         <num>    <num>    <num>   <num>    <num>   <num>   <num>   <num>
   1: 97.89047  7.24635 60.17627 3.34001  0.37778 0.00470 0.37674 0.37769
   2: 96.45416  5.20932 57.23162 3.03065  0.38071 0.00416 0.37808 0.38492
   3: 99.59658  3.11701 61.88915 1.38803  0.37282 0.00109 0.37296 0.37386
   4:       NA       NA       NA      NA       NA      NA      NA      NA
   5:       NA       NA       NA      NA       NA      NA      NA      NA
  ---                                                                    
1206: 90.10821  6.40263 49.61383 3.33149  0.40506 0.00754 0.40578 0.40980
1207: 87.79014 12.32619 50.89394 5.60068  0.40052 0.01586 0.40370 0.40804
1208: 89.77162  9.85251 52.03008 4.48633  0.39741 0.01141 0.39967 0.40304
1209: 92.37210 10.32294 56.18593 6.00066  0.39161 0.01098 0.39093 0.39995
1210: 94.75258  9.74749 56.80837 6.60961  0.39045 0.00691 0.38991 0.39626
       gcc_90 rcc_mean rcc_std  rcc_50  rcc_75  rcc_90 max_solar_elev snow_flag
        <num>    <num>   <num>   <num>   <num>   <num>          <num>    <lgcl>
   1: 0.38626  0.38951 0.01273 0.39466 0.39571 0.39645       54.28096        NA
   2: 0.38687  0.39336 0.00810 0.39596 0.40017 0.40124       53.23820        NA
   3: 0.37391  0.39544 0.00168 0.39603 0.39664 0.39692       52.16943        NA
   4:      NA       NA      NA      NA      NA      NA             NA        NA
   5:      NA       NA      NA      NA      NA      NA             NA        NA
  ---                                                                          
1206: 0.41254  0.37169 0.01263 0.37131 0.37936 0.38281       65.35487        NA
1207: 0.41201  0.36520 0.01433 0.36726 0.37245 0.37985       64.97203        NA
1208: 0.40679  0.37110 0.01590 0.37350 0.37818 0.38276       64.53198        NA
1209: 0.40318  0.36881 0.02170 0.37148 0.37907 0.38367       64.03578        NA
1210: 0.39878  0.37542 0.01358 0.37568 0.38213 0.38974       63.48545        NA
      outlierflag_gcc_mean outlierflag_gcc_50 outlierflag_gcc_75
                    <lgcl>             <lgcl>             <lgcl>
   1:                   NA                 NA                 NA
   2:                   NA                 NA                 NA
   3:                   NA                 NA                 NA
   4:                   NA                 NA                 NA
   5:                   NA                 NA                 NA
  ---                                                           
1206:                   NA                 NA                 NA
1207:                   NA                 NA                 NA
1208:                   NA                 NA                 NA
1209:                   NA                 NA                 NA
1210:                   NA                 NA                 NA
      outlierflag_gcc_90  YEAR   DOY   YYYYMMDD
                  <lgcl> <int> <int>     <char>
   1:                 NA  2014   236 2014-08-24
   2:                 NA  2014   239 2014-08-27
   3:                 NA  2014   242 2014-08-30
   4:                 NA  2014   245 2014-09-02
   5:                 NA  2014   248 2014-09-05
  ---                                          
1206:                 NA  2024   191 2024-07-09
1207:                 NA  2024   194 2024-07-12
1208:                 NA  2024   197 2024-07-15
1209:                 NA  2024   200 2024-07-18
1210:                 NA  2024   203 2024-07-21

Now, we’ll plot the GCC timeseries to see how canopy greenness changes over time at your chosen site. From the “GCC_timeseries” table, we’ll plot the variable called “gcc_90”, which corresponds to the 90th percentile of GCC values across the 3-day window within the designated ROI. Using the 90th percentile (rather than the mean) reduces the influence of changing weather and brightness across the images. See Richardson et al. (2018) for more details on data products and processing.

# Put date into date format
GCC_timeseries[,date:=as.Date(date)]

# Adjust plot area margins
par(mar=c(5, 6, 4, 2))

# Create line plot
plot(GCC_timeseries$date, GCC_timeseries$gcc_90,
     # Choose line color & type
     col = "darkgreen", type = "b",
     # Change font size
     cex = 1.5, cex.lab = 2, cex.axis = 2, cex.main = 3,
     # Add axis labels
     xlab = "Date", ylab = "GCC", 
     # Add title
     main = paste0(site_name, ": ", "Canopy Greenness Timeseries"))

Note: Since the plot isn’t saved as an object, it only appears in the built-in plot viewer for R. However, you can right click on the plot to copy and paste it elsewhere. If you accidentally close a plot and want to see it again, just re-run the code cell that created it.

Explore Seasonal Transition Dates

We can also download and plot the 50% seasonal transition dates (spring green-up and fall brown-down) for your site. We’ll use another package called “phenocamr” to download the transition dates.

# Download csv files of (1) GCC timeseries and (2) transition dates
# They will save in your designated directory (dir)
download_phenocam(site = site_name,
                  veg_type = veg,
                  frequency = 3,
                  phenophase = TRUE,
                  out_dir = dir)

# Read in the transition date csv file:

# Designate file location
trans_dates_path <- paste0(dir, "/", site_name, "_", veg, "_", ROI, "_3day_transition_dates.csv")

# Read in file
trans_dates <- read.table(trans_dates_path,
                 header = TRUE,
                 sep = ",")

trans_dates
       site veg_type roi_id direction gcc_value transition_10 transition_25
1  lacclair       DB   1000    rising    gcc_90    2015-05-09    2015-05-13
2  lacclair       DB   1000    rising    gcc_90    2016-05-16    2016-05-18
3  lacclair       DB   1000    rising    gcc_90    2017-05-13    2017-05-17
4  lacclair       DB   1000    rising    gcc_90    2018-05-15    2018-05-19
5  lacclair       DB   1000    rising    gcc_90    2019-05-19    2019-05-23
6  lacclair       DB   1000    rising    gcc_90    2020-05-17    2020-05-20
7  lacclair       DB   1000    rising    gcc_90    2021-05-08    2021-05-11
8  lacclair       DB   1000    rising    gcc_90    2022-05-08    2022-05-10
9  lacclair       DB   1000    rising    gcc_90    2023-05-07    2023-05-11
10 lacclair       DB   1000    rising    gcc_90    2024-05-08    2024-05-11
11 lacclair       DB   1000    rising    gcc_75    2015-05-08    2015-05-13
12 lacclair       DB   1000    rising    gcc_75    2016-05-16    2016-05-18
13 lacclair       DB   1000    rising    gcc_75    2017-05-13    2017-05-17
14 lacclair       DB   1000    rising    gcc_75    2018-05-16    2018-05-19
15 lacclair       DB   1000    rising    gcc_75    2019-05-19    2019-05-23
16 lacclair       DB   1000    rising    gcc_75    2020-05-17    2020-05-20
17 lacclair       DB   1000    rising    gcc_75    2021-05-08    2021-05-11
18 lacclair       DB   1000    rising    gcc_75    2022-05-08    2022-05-11
19 lacclair       DB   1000    rising    gcc_75    2023-05-07    2023-05-11
20 lacclair       DB   1000    rising    gcc_75    2024-05-08    2024-05-12
21 lacclair       DB   1000    rising    gcc_50    2015-05-08    2015-05-13
22 lacclair       DB   1000    rising    gcc_50    2016-05-16    2016-05-19
23 lacclair       DB   1000    rising    gcc_50    2017-05-14    2017-05-17
24 lacclair       DB   1000    rising    gcc_50    2018-05-15    2018-05-19
25 lacclair       DB   1000    rising    gcc_50    2019-05-19    2019-05-24
26 lacclair       DB   1000    rising    gcc_50    2020-05-17    2020-05-20
27 lacclair       DB   1000    rising    gcc_50    2021-05-08    2021-05-11
28 lacclair       DB   1000    rising    gcc_50    2022-05-08    2022-05-11
29 lacclair       DB   1000    rising    gcc_50    2023-05-08    2023-05-12
30 lacclair       DB   1000    rising    gcc_50    2024-05-09    2024-05-12
31 lacclair       DB   1000    rising  gcc_mean    2015-05-08    2015-05-13
32 lacclair       DB   1000    rising  gcc_mean    2016-05-16    2016-05-18
33 lacclair       DB   1000    rising  gcc_mean    2017-05-13    2017-05-17
34 lacclair       DB   1000    rising  gcc_mean    2018-05-15    2018-05-19
35 lacclair       DB   1000    rising  gcc_mean    2019-05-19    2019-05-24
36 lacclair       DB   1000    rising  gcc_mean    2020-05-17    2020-05-20
37 lacclair       DB   1000    rising  gcc_mean    2021-05-07    2021-05-11
38 lacclair       DB   1000    rising  gcc_mean    2022-05-08    2022-05-11
39 lacclair       DB   1000    rising  gcc_mean    2023-05-07    2023-05-12
40 lacclair       DB   1000    rising  gcc_mean    2024-05-08    2024-05-12
41 lacclair       DB   1000   falling    gcc_90    2023-10-01    2023-09-29
42 lacclair       DB   1000   falling    gcc_90    2022-09-30    2022-09-27
43 lacclair       DB   1000   falling    gcc_90    2021-09-29    2021-09-23
44 lacclair       DB   1000   falling    gcc_90    2020-09-23    2020-09-20
45 lacclair       DB   1000   falling    gcc_90    2019-10-04    2019-09-24
46 lacclair       DB   1000   falling    gcc_90    2018-10-04    2018-10-01
47 lacclair       DB   1000   falling    gcc_90    2017-10-05    2017-09-28
48 lacclair       DB   1000   falling    gcc_90    2016-10-02    2016-09-29
49 lacclair       DB   1000   falling    gcc_90    2015-10-09    2015-10-04
50 lacclair       DB   1000   falling    gcc_90    2014-09-29    2014-09-25
51 lacclair       DB   1000   falling    gcc_75    2023-10-01    2023-09-29
52 lacclair       DB   1000   falling    gcc_75    2022-10-01    2022-09-28
53 lacclair       DB   1000   falling    gcc_75    2021-10-01    2021-09-26
54 lacclair       DB   1000   falling    gcc_75    2020-09-23    2020-09-20
55 lacclair       DB   1000   falling    gcc_75    2019-10-04    2019-09-24
56 lacclair       DB   1000   falling    gcc_75    2018-10-04    2018-10-01
57 lacclair       DB   1000   falling    gcc_75    2017-10-05    2017-09-29
58 lacclair       DB   1000   falling    gcc_75    2016-10-03    2016-09-30
59 lacclair       DB   1000   falling    gcc_75    2015-10-09    2015-10-05
60 lacclair       DB   1000   falling    gcc_75    2014-09-29    2014-09-25
61 lacclair       DB   1000   falling    gcc_50    2023-10-01    2023-09-28
62 lacclair       DB   1000   falling    gcc_50    2022-10-01    2022-09-28
63 lacclair       DB   1000   falling    gcc_50    2021-10-01    2021-09-27
64 lacclair       DB   1000   falling    gcc_50    2020-09-23    2020-09-20
65 lacclair       DB   1000   falling    gcc_50    2019-09-26    2019-09-19
66 lacclair       DB   1000   falling    gcc_50    2018-10-04    2018-10-01
67 lacclair       DB   1000   falling    gcc_50    2017-09-23    2017-09-15
68 lacclair       DB   1000   falling    gcc_50    2016-10-03    2016-09-30
69 lacclair       DB   1000   falling    gcc_50    2015-10-08    2015-10-04
70 lacclair       DB   1000   falling    gcc_50    2014-09-28    2014-09-25
71 lacclair       DB   1000   falling  gcc_mean    2023-10-01    2023-09-28
72 lacclair       DB   1000   falling  gcc_mean    2022-10-01    2022-09-28
73 lacclair       DB   1000   falling  gcc_mean    2021-10-01    2021-09-27
74 lacclair       DB   1000   falling  gcc_mean    2020-09-23    2020-09-20
75 lacclair       DB   1000   falling  gcc_mean    2019-09-26    2019-09-19
76 lacclair       DB   1000   falling  gcc_mean    2018-10-04    2018-10-01
77 lacclair       DB   1000   falling  gcc_mean    2017-09-24    2017-09-15
78 lacclair       DB   1000   falling  gcc_mean    2016-10-02    2016-09-29
79 lacclair       DB   1000   falling  gcc_mean    2015-10-08    2015-10-04
80 lacclair       DB   1000   falling  gcc_mean    2014-09-28    2014-09-25
   transition_50 transition_10_lower_ci transition_25_lower_ci
1     2015-05-19             2015-05-07             2015-05-12
2     2016-05-23             2016-05-15             2016-05-17
3     2017-05-23             2017-05-11             2017-05-16
4     2018-05-23             2018-05-14             2018-05-18
5     2019-05-30             2019-05-18             2019-05-22
6     2020-05-24             2020-05-16             2020-05-19
7     2021-05-16             2021-05-06             2021-05-10
8     2022-05-16             2022-05-07             2022-05-09
9     2023-05-17             2023-05-05             2023-05-10
10    2024-05-16             2024-05-07             2024-05-10
11    2015-05-19             2015-05-07             2015-05-12
12    2016-05-23             2016-05-15             2016-05-17
13    2017-05-23             2017-05-12             2017-05-16
14    2018-05-24             2018-05-14             2018-05-18
15    2019-05-30             2019-05-18             2019-05-22
16    2020-05-24             2020-05-16             2020-05-19
17    2021-05-16             2021-05-07             2021-05-10
18    2022-05-16             2022-05-07             2022-05-10
19    2023-05-17             2023-05-05             2023-05-10
20    2024-05-16             2024-05-07             2024-05-11
21    2015-05-19             2015-05-06             2015-05-12
22    2016-05-23             2016-05-15             2016-05-18
23    2017-05-23             2017-05-12             2017-05-16
24    2018-05-24             2018-05-14             2018-05-18
25    2019-06-01             2019-05-17             2019-05-23
26    2020-05-25             2020-05-16             2020-05-19
27    2021-05-16             2021-05-06             2021-05-10
28    2022-05-17             2022-05-07             2022-05-10
29    2023-05-18             2023-05-06             2023-05-11
30    2024-05-17             2024-05-07             2024-05-11
31    2015-05-19             2015-05-05             2015-05-12
32    2016-05-23             2016-05-15             2016-05-17
33    2017-05-23             2017-05-12             2017-05-16
34    2018-05-24             2018-05-14             2018-05-18
35    2019-05-31             2019-05-18             2019-05-23
36    2020-05-25             2020-05-16             2020-05-19
37    2021-05-16             2021-05-05             2021-05-10
38    2022-05-16             2022-05-07             2022-05-10
39    2023-05-18             2023-05-05             2023-05-11
40    2024-05-16             2024-05-07             2024-05-11
41    2023-09-23             2023-10-02             2023-09-30
42    2022-09-18             2022-10-01             2022-09-28
43    2021-09-14             2021-09-30             2021-09-24
44    2020-09-15             2020-09-24             2020-09-21
45    2019-09-12             2019-10-06             2019-09-26
46    2018-09-25             2018-10-05             2018-10-02
47    2017-09-10             2017-10-07             2017-10-01
48    2016-09-19             2016-10-03             2016-09-30
49    2015-09-25             2015-10-10             2015-10-06
50    2014-09-19             2014-09-30             2014-09-26
51    2023-09-23             2023-10-02             2023-09-30
52    2022-09-20             2022-10-02             2022-09-29
53    2021-09-15             2021-10-02             2021-09-27
54    2020-09-15             2020-09-24             2020-09-21
55    2019-09-12             2019-10-06             2019-09-26
56    2018-09-24             2018-10-05             2018-10-02
57    2017-09-11             2017-10-07             2017-10-01
58    2016-09-22             2016-10-04             2016-10-01
59    2015-09-24             2015-10-10             2015-10-06
60    2014-09-19             2014-09-30             2014-09-26
61    2023-09-22             2023-10-02             2023-09-29
62    2022-09-21             2022-10-02             2022-09-29
63    2021-09-16             2021-10-02             2021-09-28
64    2020-09-14             2020-09-24             2020-09-21
65    2019-09-09             2019-09-28             2019-09-21
66    2018-09-25             2018-10-05             2018-10-02
67    2017-09-03             2017-09-28             2017-09-17
68    2016-09-22             2016-10-04             2016-10-01
69    2015-09-25             2015-10-09             2015-10-06
70    2014-09-19             2014-09-29             2014-09-26
71    2023-09-22             2023-10-02             2023-09-29
72    2022-09-21             2022-10-02             2022-09-29
73    2021-09-16             2021-10-02             2021-09-28
74    2020-09-15             2020-09-24             2020-09-21
75    2019-09-09             2019-09-28             2019-09-21
76    2018-09-25             2018-10-05             2018-10-02
77    2017-09-03             2017-09-28             2017-09-17
78    2016-09-20             2016-10-03             2016-09-30
79    2015-09-25             2015-10-09             2015-10-05
80    2014-09-19             2014-09-29             2014-09-26
   transition_50_lower_ci transition_10_upper_ci transition_25_upper_ci
1              2015-05-17             2015-05-11             2015-05-14
2              2016-05-21             2016-05-17             2016-05-20
3              2017-05-21             2017-05-15             2017-05-19
4              2018-05-22             2018-05-17             2018-05-20
5              2019-05-29             2019-05-22             2019-05-25
6              2020-05-23             2020-05-19             2020-05-21
7              2021-05-14             2021-05-10             2021-05-12
8              2022-05-14             2022-05-10             2022-05-12
9              2023-05-15             2023-05-09             2023-05-12
10             2024-05-14             2024-05-10             2024-05-13
11             2015-05-17             2015-05-11             2015-05-15
12             2016-05-22             2016-05-18             2016-05-20
13             2017-05-21             2017-05-15             2017-05-19
14             2018-05-22             2018-05-17             2018-05-21
15             2019-05-29             2019-05-22             2019-05-25
16             2020-05-23             2020-05-19             2020-05-21
17             2021-05-14             2021-05-10             2021-05-12
18             2022-05-14             2022-05-10             2022-05-12
19             2023-05-16             2023-05-09             2023-05-13
20             2024-05-15             2024-05-10             2024-05-13
21             2015-05-18             2015-05-11             2015-05-15
22             2016-05-22             2016-05-18             2016-05-20
23             2017-05-21             2017-05-16             2017-05-19
24             2018-05-22             2018-05-17             2018-05-21
25             2019-05-30             2019-05-21             2019-05-26
26             2020-05-23             2020-05-19             2020-05-21
27             2021-05-15             2021-05-10             2021-05-13
28             2022-05-15             2022-05-10             2022-05-13
29             2023-05-16             2023-05-10             2023-05-14
30             2024-05-15             2024-05-11             2024-05-13
31             2015-05-17             2015-05-10             2015-05-15
32             2016-05-22             2016-05-18             2016-05-20
33             2017-05-21             2017-05-15             2017-05-19
34             2018-05-22             2018-05-17             2018-05-21
35             2019-05-29             2019-05-21             2019-05-26
36             2020-05-23             2020-05-19             2020-05-22
37             2021-05-15             2021-05-10             2021-05-12
38             2022-05-15             2022-05-10             2022-05-13
39             2023-05-16             2023-05-09             2023-05-13
40             2024-05-15             2024-05-10             2024-05-13
41             2023-09-24             2023-09-29             2023-09-27
42             2022-09-21             2022-09-28             2022-09-24
43             2021-09-16             2021-09-26             2021-09-20
44             2020-09-17             2020-09-21             2020-09-19
45             2019-09-15             2019-09-30             2019-09-21
46             2018-09-27             2018-10-02             2018-09-29
47             2017-09-13             2017-10-03             2017-09-24
48             2016-09-22             2016-09-30             2016-09-27
49             2015-09-28             2015-10-07             2015-10-02
50             2014-09-21             2014-09-27             2014-09-23
51             2023-09-24             2023-09-29             2023-09-27
52             2022-09-22             2022-09-29             2022-09-26
53             2021-09-18             2021-09-29             2021-09-23
54             2020-09-17             2020-09-21             2020-09-19
55             2019-09-15             2019-09-30             2019-09-21
56             2018-09-27             2018-10-02             2018-09-29
57             2017-09-13             2017-10-03             2017-09-25
58             2016-09-25             2016-10-01             2016-09-28
59             2015-09-27             2015-10-07             2015-10-03
60             2014-09-21             2014-09-27             2014-09-23
61             2023-09-24             2023-09-29             2023-09-27
62             2022-09-23             2022-09-30             2022-09-26
63             2021-09-19             2021-09-29             2021-09-24
64             2020-09-16             2020-09-21             2020-09-18
65             2019-09-12             2019-09-23             2019-09-17
66             2018-09-27             2018-10-02             2018-09-29
67             2017-09-07             2017-09-18             2017-09-12
68             2016-09-25             2016-10-01             2016-09-28
69             2015-09-28             2015-10-06             2015-10-02
70             2014-09-21             2014-09-26             2014-09-23
71             2023-09-24             2023-09-29             2023-09-27
72             2022-09-23             2022-09-30             2022-09-26
73             2021-09-18             2021-09-29             2021-09-24
74             2020-09-16             2020-09-21             2020-09-18
75             2019-09-11             2019-09-23             2019-09-17
76             2018-09-27             2018-10-02             2018-09-29
77             2017-09-07             2017-09-18             2017-09-12
78             2016-09-23             2016-09-30             2016-09-27
79             2015-09-27             2015-10-06             2015-10-02
80             2014-09-21             2014-09-26             2014-09-23
   transition_50_upper_ci threshold_10 threshold_25 threshold_50 min_gcc
1              2015-05-20      0.32282      0.33873      0.37633 0.31121
2              2016-05-24      0.32499      0.33779      0.37759 0.31397
3              2017-05-24      0.32248      0.33773      0.37307 0.31226
4              2018-05-24      0.32232      0.34202      0.37272 0.31386
5              2019-05-31      0.32244      0.33885      0.37458 0.31313
6              2020-05-25      0.32011      0.34083      0.37363 0.31375
7              2021-05-17      0.32547      0.34155      0.37830 0.31473
8              2022-05-17      0.32461      0.33626      0.38019 0.31399
9              2023-05-18      0.32445      0.34029      0.37266 0.31464
10             2024-05-17      0.32472      0.33738      0.37670 0.31496
11             2015-05-20      0.31866      0.33558      0.37064 0.30999
12             2016-05-24      0.32174      0.33357      0.37112 0.31283
13             2017-05-24      0.32059      0.33546      0.36948 0.31127
14             2018-05-25      0.32389      0.33758      0.37576 0.31279
15             2019-05-31      0.32118      0.33668      0.37051 0.31226
16             2020-05-25      0.31855      0.33719      0.36704 0.31297
17             2021-05-17      0.32337      0.33863      0.37405 0.31395
18             2022-05-17      0.32346      0.34071      0.37400 0.31298
19             2023-05-18      0.32342      0.33760      0.36679 0.31341
20             2024-05-17      0.32282      0.34070      0.37152 0.31404
21             2015-05-20      0.31712      0.33193      0.36312 0.30813
22             2016-05-24      0.31952      0.33766      0.36566 0.31100
23             2017-05-24      0.32024      0.33181      0.36440 0.30988
24             2018-05-25      0.31909      0.33510      0.36836 0.31181
25             2019-06-02      0.32033      0.33658      0.36865 0.31091
26             2020-05-26      0.31685      0.33317      0.36564 0.31093
27             2021-05-17      0.32236      0.33523      0.36513 0.31276
28             2022-05-18      0.32051      0.33494      0.37103 0.31152
29             2023-05-19      0.32150      0.33616      0.36426 0.31162
30             2024-05-18      0.32242      0.33585      0.37177 0.31266
31             2015-05-20      0.31752      0.33225      0.36299 0.30792
32             2016-05-24      0.31905      0.33013      0.36527 0.31063
33             2017-05-24      0.31745      0.33228      0.36524 0.30940
34             2018-05-25      0.31905      0.33496      0.36944 0.31150
35             2019-06-01      0.31925      0.33625      0.36611 0.31045
36             2020-05-26      0.31650      0.33260      0.36501 0.31088
37             2021-05-17      0.32026      0.33561      0.36605 0.31213
38             2022-05-17      0.32013      0.33493      0.36437 0.31116
39             2023-05-19      0.32017      0.33688      0.36402 0.31122
40             2024-05-17      0.32047      0.33689      0.36570 0.31221
41             2023-09-22      0.32361      0.33570      0.36651 0.31526
42             2022-09-12      0.32957      0.34284      0.37344 0.32091
43             2021-09-12      0.33496      0.34930      0.37477 0.32794
44             2020-09-14      0.32582      0.34045      0.36759 0.31781
45             2019-09-11      0.32359      0.33968      0.36880 0.31465
46             2018-09-24      0.33077      0.34534      0.37294 0.32247
47             2017-09-07      0.32647      0.34261      0.36958 0.31694
48             2016-09-17      0.32538      0.34071      0.36928 0.32072
49             2015-09-23      0.32234      0.34016      0.36704 0.31508
50             2014-09-17      0.32300      0.33886      0.36762 0.31522
51             2023-09-22      0.32144      0.33349      0.36361 0.31318
52             2022-09-18      0.32330      0.33677      0.36721 0.31372
53             2021-09-14      0.32634      0.34137      0.36982 0.31992
54             2020-09-14      0.32351      0.33787      0.36455 0.31566
55             2019-09-10      0.32177      0.33797      0.36557 0.31267
56             2018-09-23      0.32608      0.33982      0.36938 0.31839
57             2017-09-08      0.32458      0.33937      0.36495 0.31593
58             2016-09-20      0.31773      0.33338      0.36150 0.31229
59             2015-09-22      0.32028      0.33507      0.36365 0.31350
60             2014-09-18      0.32070      0.33634      0.36479 0.31392
61             2023-09-21      0.31641      0.33522      0.36283 0.31226
62             2022-09-19      0.31967      0.33314      0.36122 0.31013
63             2021-09-15      0.32325      0.33679      0.36382 0.31616
64             2020-09-13      0.31725      0.33122      0.36232 0.31228
65             2019-09-07      0.33268      0.34498      0.36730 0.32536
66             2018-09-24      0.32100      0.33482      0.36185 0.31325
67             2017-08-29      0.34361      0.35342      0.37297 0.33639
68             2016-09-20      0.31407      0.33000      0.35807 0.30856
69             2015-09-22      0.32094      0.33659      0.35899 0.31472
70             2014-09-17      0.31935      0.33071      0.35947 0.31181
71             2023-09-21      0.31665      0.33533      0.36256 0.31253
72             2022-09-19      0.31991      0.33347      0.36120 0.31030
73             2021-09-15      0.32351      0.33689      0.36347 0.31656
74             2020-09-14      0.31713      0.33137      0.35863 0.31202
75             2019-09-07      0.33283      0.34452      0.36674 0.32569
76             2018-09-24      0.32137      0.33508      0.36224 0.31374
77             2017-08-29      0.34358      0.35315      0.37255 0.33639
78             2016-09-18      0.31838      0.33457      0.36058 0.31344
79             2015-09-22      0.32063      0.33564      0.35892 0.31488
80             2014-09-18      0.31920      0.33075      0.35983 0.31192
   max_gcc
1  0.42854
2  0.43286
3  0.42545
4  0.42960
5  0.43448
6  0.42840
7  0.42853
8  0.43271
9  0.42341
10 0.42878
11 0.42078
12 0.42606
13 0.42119
14 0.42474
15 0.42756
16 0.42005
17 0.42414
18 0.42774
19 0.41974
20 0.42169
21 0.41454
22 0.41907
23 0.41386
24 0.41356
25 0.41849
26 0.41021
27 0.41591
28 0.42054
29 0.41541
30 0.41674
31 0.41247
32 0.41709
33 0.41243
34 0.41557
35 0.41740
36 0.41109
37 0.41511
38 0.41667
39 0.41461
40 0.41629
41 0.41750
42 0.42371
43 0.42002
44 0.41341
45 0.41916
46 0.41994
47 0.42112
48 0.41526
49 0.41561
50 0.41800
51 0.41393
52 0.41947
53 0.41461
54 0.40856
55 0.41603
56 0.41499
57 0.41391
58 0.40830
59 0.41041
60 0.41273
61 0.41028
62 0.41160
63 0.40713
64 0.40459
65 0.40684
66 0.40525
67 0.40905
68 0.40387
69 0.40288
70 0.40611
71 0.40697
72 0.41087
73 0.40692
74 0.40369
75 0.40661
76 0.40617
77 0.40870
78 0.40444
79 0.40248
80 0.40544

Now we’ll plot the transition dates on the GCC timeseries.

# Pull out transition dates from the trans_dates table

# Select the rising (spring dates) for 50% threshold of Gcc 90
td_rise <- trans_dates[trans_dates$direction == "rising" & trans_dates$gcc_value == "gcc_90",]

# Select the falling (fall dates) for 50% threshold of Gcc 90
td_fall <- trans_dates[trans_dates$direction == "falling" & trans_dates$gcc_value == "gcc_90",]


# As above, create a simple line graph of the Green Chromatic Coordinate (GCC)

# Plot- this time use "type = 1" to create a smooth line graph
plot(GCC_timeseries$date, GCC_timeseries$gcc_90, 
     col = "black", type = "l",
     cex = 2, cex.lab = 2, cex.axis = 2, cex.main = 3,
     xlab = 'Date', ylab = 'GCC', 
     main = paste0(site_name, ': ', 'Seasonal Transition Dates'))


# Add points to show transition dates:

# Spring green-up
points(x = as.Date(td_rise$transition_50, origin = "1970-01-01"),
       y = td_rise$threshold_50,
       pch = 19, cex = 2,
       col = "green")

# Fall brown-down
points(x = as.Date(td_fall$transition_50, origin = "1970-01-01"),
       y = td_fall$threshold_50,
       pch = 19, cex = 2,
       col = "brown")

Now, let’s explore the variability of seasonal transition dates throughout the available data years. This works best if you chose a site with a longer timeseries. We’ll first convert the transition dates into a “day-of-year” (DOY) format (e.g., Jan 1 = DOY 1, Jan 2 = DOY 2, etc.), and then plot those by year.

# Convert green-up dates to date format and then DOY
td_spring_dates <- as.Date(td_rise$transition_50,format='%Y-%m-%d')
td_spring_DOY <- lubridate::yday(td_spring_dates)

# Convert brown-down dates to date format and then DOY
td_fall_dates <- as.Date(td_fall$transition_50,format='%Y-%m-%d')
td_fall_DOY <- lubridate::yday(td_fall_dates)

# Extract spring data years
years_spr <- as.numeric(format(td_spring_dates,'%Y'))

# Create table of years and spring transition dates
trans_table_spring <- data.frame(years_spr, td_spring_DOY)

# Plot spring green-up dates
plot(trans_table_spring[,1],trans_table_spring[,2], 
    type = "b", col = "darkgreen",
    cex = 2, cex.lab = 2, cex.axis = 2, cex.main = 3,
    xlab = 'Year', ylab = 'Spring Transition Date (DOY)',
    main = paste0(site_name, ': ', 'Date of Spring Onset Through the Years'))

And now plot the fall brown-down transition dates.

# Extract fall data years
years_fall <- as.numeric(format(td_fall_dates,'%Y'))

# Create table of years and fall transition dates
trans_table_fall <- data.frame(years_fall, td_fall_DOY)

# Plot fall brown-down dates
plot(trans_table_fall[,1],trans_table_fall[,2], 
     type = "b", col = "brown",
     cex = 2, cex.lab = 2, cex.axis = 2, cex.main = 3,
     xlab = 'Year', ylab = 'Autumn Transition Date (DOY)',
     main = paste0(site_name, ': ', 'Date of Autumn Onset Through the Years'))

As you can see, there is a decent amount of year-to-year variability in when a site greens up (spring) or browns down (fall), directly impacting the total length of the growing sesason. This variability is largely due to differences in weather, such as precipitation and temperature. Climate change is also shifting seasonal transition dates, which can impact many other variables, such as plant-animal interactions and ecosystem carbon and water storage.

Download PhenoCam Images

Next, we’ll download some photos from your chosen site. Images are typically taken every 30 minutes, but for simplicity, we’ll just download 1 image per month in order to visualize phenology changes. This code downloads the midday (~12 pm) image for the 15th day (“days = 15”) of each month (“months = 1:12”) for the year you chose above. The images will appear in the folder you designated above (dir).

# Download PhenoCam images
download_midday_images(site = site_name,
                       y = year, 
                       months = 1:12, 
                       days = 15,
                       download_dir = dir)

Now, we’ll use those images to create a photo collage that displays changes in phenology throughout the year. First, we’ll set it up and check that it’s working correctly. You should have 12 images (1 per month), so when you run the code below, “n” should equal 12. If not, look in your “dir” (pheno_images) folder and make sure it only includes images for a single PhenoCam site. If you have more than 12, right click on the images you don’t want and delete them from the folder.

# Isolate images from your designated directory
# Pics are jpeg format
middays_path <- dir(dir, pattern = "*.jpg", full.names = TRUE)

# See a sample of image directory paths to make sure it worked
head(middays_path)
[1] "./pheno_images/lacclair_2022_01_15_120011.jpg"
[2] "./pheno_images/lacclair_2022_02_15_120010.jpg"
[3] "./pheno_images/lacclair_2022_03_15_120007.jpg"
[4] "./pheno_images/lacclair_2022_04_15_120008.jpg"
[5] "./pheno_images/lacclair_2022_05_15_120005.jpg"
[6] "./pheno_images/lacclair_2022_06_15_120006.jpg"
# Determine number of images (should be 12, 1 per month)
n <- length(middays_path)
n
[1] 12

Then we’ll create the layout.

# Set up image layout (4 rows & 3 columns)
par(mar= c(0,0,0,0), mfrow=c(4,3), oma=c(0,23,3,23))

# Create monthly image layout with labels (this can take 1-2 min)
for(i in 1:n){
  img <- jpeg::readJPEG(middays_path[i])
  plot(0:1,0:1, type='n', axes= FALSE, xlab= '', ylab = '')
  rasterImage(img, 0, 0, 1, 1)
  mtext(month.name[i], line = -2)
}

# Add title (feel free to edit the title below)
mtext(paste0(site_name, ': ', 'Canopy Greenness Through the Months'), font = 2, cex = 1.8, outer = TRUE)

Finally, we’ll use those same images to create a gif that shows changes in phenology over time. This is great to use in presentations to visualize seasonal transitions!

# Make timelapse gif of images
gif <- list.files(path = dir, pattern = "*.jpg", full.names = T) %>% 

  purrr::map(image_read) %>% 
  
  image_join() %>% 
  
  # Add text to each image -  you can change the size, location, color below
  image_annotate(paste(site_name,"Jan-Dec", year), 
                 location = "+900+30", 
                 size = 35, 
                 color = "black") %>%
  
  # Frames per second (higher number = faster, lower number = slower)
  image_animate(fps=0.5) %>%
  
  # Designate file name & save to your directory
  image_write(paste0(dir, "/MonthlyGreenness_gif.gif")) 

# The gif will be saved to the directory you indicated at the beginning 
# You can check the directory path below
dir
[1] "./pheno_images"

As an example, here’s the gif I made for the lacclair site. Your gif will be saved to the directory you indicated at the beginning (dir). If you want to save it, right click on the gif file name and select “download”.

Monthly Greenness

Explore another site!

Now try this exercise with another PhenoCam site. Perhaps choose a different ecosystem type. Think about how seasonal greenness patterns differ between sites. What do you think causes these differences?

To do this, edit the cell near the beginning where you assign the site name, vegetation type, year, and ROI (in the “Download & Plot Canopy Greenness” section). Be sure to re-run that cell and all cells below it in sequential order.

But before trying a new site, run this code cell to re-set your plotting parameters and delete all the downloaded files in your “pheno_images” (dir) folder. Be sure to download your gif first if you want to save a copy.

# Reset plotting parameters
dev.off()
null device 
          1 
# List all files in "pheno_images"
f <- list.files(dir, include.dirs = F, full.names = T, recursive = T)

# Remove the files
file.remove(f)
 [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE

Thank you

Thanks for exploring PhenoCam data. Hopefully, you have a stronger appreciation for phenology now!